//
//  SandBox.m
//  王宇先_15_文件读写
//
//  Created by wyx on 16/3/29.
//  Copyright © 2016年 Apon. All rights reserved.
//

#import "SandBox.h"

@implementation SandBox
#pragma mark - create and init
+(instancetype)sandBoxHandler{
    SandBox *sand = [[SandBox alloc] init];
    return sand;
}
#pragma mark - 三个文件路径
/** SandBox路径 */
- (NSString *)pathOfAppSandBox{
    return NSHomeDirectory();
}
/** 获取 Documents 路径 */
- (NSString *)pathOfDocuments{
    return   [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
}
/** 获取Tem 路径    */
- (NSString *)pathOfTemp{
    return  NSTemporaryDirectory();
}
/** 获取 Library 路径 */
- (NSString *)pathOfLibrary{
    return [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) lastObject];
}
/** 获取 Caches路径 */
- (NSString *)pathOfCaches{
    return [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) lastObject];
}
/** 获取Preferences路径 */
- (NSString *)pathOfPreferences{
    return [[self pathOfLibrary] stringByAppendingPathComponent:@"Preferences"];
}
/** 自定义 */
+ (NSString *)pathOfDocuments{
    return     [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
}
+ (NSString *)saveInDocumentWithFileName:(NSString *)name{
    return [[SandBox pathOfDocuments] stringByAppendingPathComponent:name];
}

@end
